package com.ruoyi.basebill.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.basebill.domain.WfzSbsjsentry;
import com.ruoyi.basedata.domain.WfzGybaseunit;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.basebill.domain.TWfzSbsjs;
import com.ruoyi.basebill.service.ITWfzSbsjsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 社保实际数录入Controller
 * 
 * @author ruoyi
 * @date 2022-12-28
 */



/**
 * 已废弃，由 WfzSbsjsController 替代
 */








@RestController
@RequestMapping("/basebill/sbsjs1")
public class TWfzSbsjsController extends BaseController
{
    @Autowired
    private ITWfzSbsjsService tWfzSbsjsService;

    /**
     * 查询社保实际数录入列表
     */
    @PreAuthorize("@ss.hasPermi('basebill:sbsjs:list')")
    @GetMapping("/list")
    public TableDataInfo list(TWfzSbsjs tWfzSbsjs)
    {
        startPage();
        List<TWfzSbsjs> list = tWfzSbsjsService.selectTWfzSbsjsList(tWfzSbsjs);
        return getDataTable(list);
    }

    /**
     * 导出社保实际数录入列表
     */
    @PreAuthorize("@ss.hasPermi('basebill:sbsjs:export')")
    @Log(title = "社保实际数录入", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TWfzSbsjs tWfzSbsjs)
    {
        List<TWfzSbsjs> list = tWfzSbsjsService.selectTWfzSbsjsList(tWfzSbsjs);
        ExcelUtil<TWfzSbsjs> util = new ExcelUtil<TWfzSbsjs>(TWfzSbsjs.class);
        util.exportExcel(response, list, "社保实际数录入数据");
    }

    /**
     * 下载模板
     * @param response
     */
    @PostMapping("/importTemplate")
    public void importTemplate(HttpServletResponse response)
    {
        ExcelUtil<WfzSbsjsentry> util = new ExcelUtil<>(WfzSbsjsentry.class);
        util.importTemplateExcel(response,"案卷数据");
    }

    /**
     * 获取社保实际数录入详细信息
     */
    @PreAuthorize("@ss.hasPermi('basebill:sbsjs:query')")
    @GetMapping(value = "/{fid}")
    public AjaxResult getInfo(@PathVariable("fid") Long fid)
    {
        return success(tWfzSbsjsService.selectTWfzSbsjsByFid(fid));
    }

    /**
     * 新增社保实际数录入
     */
    @PreAuthorize("@ss.hasPermi('basebill:sbsjs:add')")
    @Log(title = "社保实际数录入", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TWfzSbsjs tWfzSbsjs)
    {
        return toAjax(tWfzSbsjsService.insertTWfzSbsjs(tWfzSbsjs));
    }

    /**
     * 修改社保实际数录入
     */
    @PreAuthorize("@ss.hasPermi('basebill:sbsjs:edit')")
    @Log(title = "社保实际数录入", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TWfzSbsjs tWfzSbsjs)
    {
        return toAjax(tWfzSbsjsService.updateTWfzSbsjs(tWfzSbsjs));
    }

    /**
     * 删除社保实际数录入
     */
    @PreAuthorize("@ss.hasPermi('basebill:sbsjs:remove')")
    @Log(title = "社保实际数录入", businessType = BusinessType.DELETE)
	@DeleteMapping("/{fids}")
    public AjaxResult remove(@PathVariable Long[] fids)
    {
        return toAjax(tWfzSbsjsService.deleteTWfzSbsjsByFids(fids));
    }
}
